<template>
  <fieldset>
      <legend>List组件</legend>
        <button @click="add">添加</button>
        <ul>
            <li v-for="(item,index) in arr" :key="index">{{item}}</li>
        </ul>


      </fieldset>
</template>
<script>
export default {
    data () {
        return {
            arr:["吃饭","睡觉","看比赛"]
        }
    },
    methods: {
        add(){
            this.arr.push(this.data)
           
        }
    },
    props: ['data']  //props传过来的值是个只读属性，不能修改
  
}
</script>